import React from 'react';
import { cloneDeep } from 'lodash'
import { Switch, Route, Redirect } from 'react-router-dom';

import Overview from "../pages/Home";
// 资产管理
import Jobs from '../pages/AssetManage/Jobs'
import Detail from '../pages/AssetManage/Detail'
import BatchAdd from '../pages/BatchAdd'
import WebVulDetail from '../pages/JobManage/WebTask/TaskDetail/WebTaskDetail/VulDetail'
import WebChangeCheckDetail from '../pages/JobManage/WebTask/TaskDetail/WebTaskDetail/ChangeCheckDetail'
import WebSSLDetail from '../pages/JobManage/WebTask/TaskDetail/WebTaskDetail/SSLDetail'
import SecurityEventDetailP from '../pages/JobManage/WebTask/TaskDetail/SecurityEventDetail/DetailP';
import ContentDetailC from '../pages/JobManage/WebTask/TaskDetail/ContentDetail/DetailC';
import hostVulDetail from '../pages/Task/TaskDetail/HostDetail/VulDetail';

// 任务管理
import WebTaskList from '../pages/JobManage/WebTask'
import CreateJobAll from '../pages/CreateJob/CreateJob';
import WebCreateTaskTest from '../pages/CreateJob/index_web.jsx';
import WebTaskDetail from '../pages/JobManage/WebTask/TaskDetail';
import WebHistory from '../pages/JobManage/WebTask/TaskDetail/WebTaskHistory';
import AviliableTask from '../pages/JobManage/AviliableTask';
import AviliableTaskDetail from '../pages/JobManage/AviliableTask/TaskDetail';
import IPv6Overview from '../pages/Ipv6Monitor/Overview';
import IPv6Detail from '../pages/Ipv6Monitor/Detail';
import IPv6LinkDetail from '../pages/Ipv6Monitor/Detail/linkDetail';
import hostOverview from '../pages/Task/TaskInfo';
import hostDetail from '../pages/Task/TaskDetail';

// 网站画像
import SitePortrait from '../pages/SitePortrait'

// 云防联动
import Yfld from '../pages/Yfld/Overview'
import IpSet from '../pages/Yfld/IpSet'
import Blacklist from '../pages/Yfld/Blacklist'

// 报表中心
import Dashboard from '../pages/Dashboard/dashboard';
import DownFiles from '../pages/Dashboard/DownFiles';

// 告警中心
import AlertList from '../pages/Alert/AlertList'
import AlertSettings from '../pages/Alert/AlertSettings';

// 综合管理
import KeywordSettings from '../pages/PolicyManage/KeywordSettings';
import OperationLog from '../pages/GeneralManagement/OperationLog';
import ApiPage from '../pages/ApiPage';
import VulTempSettings from '../pages/PolicyManage/vulTempSettings';
import CreateVulTemp from '../pages/PolicyManage//vulTempSettings/createTemp';
import IgnoreRiskManage from '../pages/PolicyManage/IgnoreRiskManage';
import IgnoreRiskDetail from '../pages/PolicyManage/IgnoreRiskManage/detail';
import ChangeCheckPages  from '../pages/PolicyManage/ChangeCheckPage';

// 漏洞库
import BugStore from '../pages/GeneralManagement/BugStore';

// 消息中心
import NotificationCentre from '../pages/MessageCentre/NotificationCentre';
import NotificationDetail from '../pages/MessageCentre/NotificationCentre/Detail';
import SystemCentre from '../pages/MessageCentre/SystemCentre';
import VulCentre from '../pages/MessageCentre/VulCentre';

// 服务条款
import Disclaimer from '../pages/Disclaimer';

// 报告推送
import TaskReport from '../reports/task_report';


const NavList = [
  {
    path: '/',
    component: Overview,
  },
  {
    path: '/report/task_report',
    component: TaskReport,
  },
  {
    path: '/asset-manage/manage/:assetType',
    component: Jobs,
  },
  {
    path: '/asset-manage/manage/:assetType/Detail',
    component: Detail,
  },
  {
    path: '/asset-manage/manage/batch_add/:assetType',
    component: BatchAdd,
  },
  {
    path: '/asset-manage/manage/web/vul-detail',
    component: WebVulDetail,
  },
  {
    path: '/asset-manage/manage/web/change-check-detail',
    component: WebChangeCheckDetail,
  },
  {
    path: '/asset-manage/manage/web/ssl-detail',
    component: WebSSLDetail,
  },
  {
    path: '/asset-manage/manage/web/securityEvent-detail/:taskId/DetailP',
    component: SecurityEventDetailP,
  },
  {
    path: '/asset-manage/manage/web/content-detail/:taskId/DetailC',
    component: ContentDetailC,
  },
  {
    path: '/asset-manage/manage/host/host-task/detail',
    component: hostVulDetail,
  },
	// 任务管理
  {
    path: '/job-manage/web-task',
    component: WebTaskList,
  },
  {
    path: '/job-manage/create-job',
    component: WebCreateTaskTest,
  },
  {
    path: '/job-manage/create-job-all',
    component: CreateJobAll,
  },
  {
    path: '/job-manage/web-task/detail',
    component: WebTaskDetail,
  },
  {
    path: '/job-manage/web-task/vul-detail',
    component: WebVulDetail,
  },
  {
    path: '/job-manage/web-task/change-check-detail',
    component: WebChangeCheckDetail,
  },
  {
    path: '/job-manage/web-task/ssl-detail',
    component: WebSSLDetail,
  },
  {
    path: '/job-manage/web-task/content-detail/:taskId/DetailC',
    component: ContentDetailC,
  },
  {
    path: '/job-manage/web-task/securityEvent-detail/:taskId/DetailP',
    component: SecurityEventDetailP,
  },
  {
    path: '/job-manage/web-task/history',
    component: WebHistory,
  },
	{
    path: '/job-manage/host-task',
    component: hostOverview,
  },
	{
    path: '/job-manage/host-task/detail',
    component: hostDetail,
  },
	{
    path: '/job-manage/host-task/vul-detail',
    component: hostVulDetail,
  },
	{
    path: '/job-manage/ipv6-monitor',
    component: IPv6Overview,
  },
	{
    path: '/job-manage/ipv6-monitor/detail/:id',
    component: IPv6Detail,
  },
	{
    path: '/job-manage/ipv6-monitor/linkDetail/:id/:type',
    component: IPv6LinkDetail,
  },
	{
    path: '/job-manage/aviliable-task',
    component: AviliableTask,
  },
	{
    path: '/job-manage/aviliable-task/detail',
    component: AviliableTaskDetail,
  },
	// 网站画像
  {
    path: '/site-portrait/:jobId?',
    component: SitePortrait,
  },
	// 云防联动
	{
		path: '/yfld',
		component: Yfld,
	},
	{
		path: '/yfld/whitelist',
		component: IpSet,
	},
	{
		path: '/yfld/blacklist/:type',
		component: Blacklist,
	},
	// 报表中心
	{
		path: '/dashboard/center/:jobId/:taskCategory?',
		component: Dashboard,
	},
	{
		path: '/dashboard/downList',
		component: DownFiles,
	},
	// 告警中心
	{
		path: '/alert/list/:category',
		component: AlertList,
	},
	{
		path: '/alert/settings/:type',
		component: AlertSettings,
	},
	// 综合管理
	{
		path: '/policy-manage/ignore-risk-manage',
		component: IgnoreRiskManage,
	},
	{
		path: '/policy-manage/ignore-risk-detail',
		component: IgnoreRiskDetail,
	},
	{
		path: '/policy-manage/keyword-settings/:type',
		component: KeywordSettings,
	},
	{
		path: '/policy-manage/vul-template-settings/list',
		component: VulTempSettings,
	},
	{
		path: '/policy-manage/change-check-pages/list',
		component: ChangeCheckPages,
	},
  {
    path: '/policy-manage/change-check-pages/list',
		component: ChangeCheckPages
  },
	{
		path: '/policy-manage/general/operation-log',
		component: OperationLog,
	},
	{
		path: '/policy-manage/vul-template-settings/create',
		component: CreateVulTemp,
	},
	// 漏洞库
	{
		path: '/general/bug-store',
		component: BugStore,
	},
	// 消息中心
	{
		path: '/message/notification-centre',
		component: NotificationCentre,
	},
	{
		path: '/message/vul-centre',
		component: VulCentre,
	},
	{
		path: '/message/system-centre',
		component: SystemCentre,
	},
	{
		path: '/message/notification-centre/:id',
		component: NotificationDetail,
	},
	// 服务条款
	{
		path: '/disclaimer',
		component: Disclaimer,
	},
	// API管理
	{
		path: '/policy-manage/api-page',
		component: ApiPage,
	}
]

const Router = () => {
  const [navData, setNavData] = React.useState(NavList);
  return (
    <Switch>
      {navData.map((e, i) => {
        return <Route exact path={e.path} component={e.component} key={i} />;
      })}
      <Route path="/jobs" exact render={() => <Redirect to="/asset-manage/manage/web" />} />
      <Route path="/dashboard" exact render={() => <Redirect to="/dashboard/center/:jobId/weakness" />} />
      <Route path="/**" exact render={() => <Redirect to="/" />} />
    </Switch>
  );
}
export { Router }
